<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function runajax(){
            return new Promise(function(resoive,reject){
                // console.log('hello word');
                setTimeout(function(){
                    console.log('定时器--做菜');
                    resoive('西红柿');//调用你传入的函数
                },2000);
            })
        }
        // 调用
        //runajax();
        var p=runajax();
        // then异步后执行
        p.then(function(ret){
            console.log("做饭",ret);
        })
        // console.log("函数..........");
    </script>
</body>
</html>